/* Copyright (c) Byron Adams <byron.adams54@gmail.com>
   See the file LICENSE for licensing information. */

translator.service({
  meta : {
    version : "0.0.1",
    shortName : "acapela",
    name : "Acapela HQ TTS",
    icon : "",
    desc : "",
    homepage : "http://www.acapela-group.com/"
  },

  voice : {
    charLimit : 250,
    url : "http://vaas3.acapela-group.com/connector/1-20/textToMP3.php",
    method : "POST",
    params: {
        client_text : "{{text}}",
        client_login : "asTTS",
        client_password : "demo_web",
        client_request_type : "CREATE_REQUEST",
        action_script_version : "3",
        client_voice : "heather22k"        
    },
    file : function (response) {
        var url = false;
        if (response.match("retour_php=") != null && response.match("@ERROR") == null) {
            url = response.split("retour_php=")[1].split("&file_id=")[0]
        }
        return url;
    }
  }
});



 /*
$.ajax({
    type : "POST",
    url : "http://vaas3.acapela-group.com/connector/1-20/textToMP3.php",
    data : {
        client_text : "Albert Johnson III (born November 11, 1977 in Houston, Texas) is a Canadian Football League player for the Winnipeg Blue Bombers. Johnson played his college football for Southern Methodist University and then signed with the Saskatchewan Roughriders where he played three games in 1999. Johnson then signed with the Blue Bombers and went on to win the league's Rookie of the Year Award in 2000 after leading the league in return yardage. He signed with the Miami Dolphins in 2001 and later played with the New York Jets and Houston Texans but suffered injuries throughout his National Football League stint. In 2006 Johnson returned to the Blue Bombers and once again lead the CFL in return yardage and was second in combined yards to fellow team-mate Charles Roberts.",
        client_login : "asTTS",
        client_password : "demo_web",
        client_request_type : "CREATE_REQUEST",
        action_script_version : "3",
        client_voice : "heather22k"        
    },
    success : function (data) {
         var url = data.split("retour_php=")[1].split("&file_id=")[0];
         console.log(url);
        $("body")[0].innerHTML += "<embed src=\"" + url + "\" type=\"audio/mpeg\"/ style=\"height:0px;\"/>";
    }
});


Supported Languages [17] :

["Arabic", "Czech", "Danish", "Dutch", "English", "Finnish", "French", "German", "Greek", "Italian", "Polish", "Portuguese", "Russian", "Spanish", "Swedish", "Turkish"]


client_voice parameters :

The 22k suffix represents the sampling frequency, 8, 11, 16 & 22 are supposed to work but only 8 & 22 seem to work in this case.
this could be useful for slow internet connections...

antonio22k : spanish [Male]
maria22k : spanish [Female]
salma22k : Arabic [Female]
youssef22k : Arabic [Male]
celia22k : Protuguese [Female]
eliska22k : czech [Female]
mette22k : danish [Female]
max22k : dutch [male]
femke22k : dutch [female]
graham22k : english [UK] [Male]
lucy22k : english [UK] [Female]
heather22k : english [US] [Female]
ryan22k : english [US] [Male]
sanna22k : finnish [Female]
alice22k : french [Female]
bruno22k : french [Male]
sarah22k : german [Female]
klaus22k : german [Male]
dimitris22k : Greek [Male]
chiara22k : italian [Female]
vittorio22k : italian [Male]
kari22k : Norweigen [Female]
olav22k : Norwigien [Male]
ania22k : Polish [Female]
alyona22k : Russian [Female]
elin22k : Swedish [Female]
erik22k : Swedish [Male]
ipek22k : Turkish [Female]

 */